// 创建useConsultStore
import type { ConsultInfo } from '@/types/consult'
import { defineStore } from 'pinia'
import { ref } from 'vue'

export const useConsultStore = defineStore(
  'consult',
  () => {
    // 患者病情初始数据
    const initalValue = {
      illnessDesc: '',
      illnessTime: 1,
      consultFlag: 0,
      pictures: [],
    }
    const consultInfo = ref<ConsultInfo>({ ...initalValue })

    // 极速问诊
    const type = ref('')
    // 问诊类型
    const illnessType = ref('')
    // 科室ID
    const depId = ref('')
    // 患者ID
    const patientId = ref('')

    // 清空参数
    const clear = () => {
      consultInfo.value = { ...initalValue }
      type.value = ''
      illnessType.value = ''
      depId.value = ''
      patientId.value = ''
    }

    return { consultInfo, initalValue, type, illnessType, depId, patientId, clear }
  },
  { unistorage: true }
)
